import { createApp } from 'vue'
import App from './App.vue'
import router from './router/index'
import { createPinia } from 'pinia'
import { Http } from '@/utils/http'
import components from '@/components/index'
import i18n from '@/i18n/index'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import ElementPlus from 'element-plus'
import directive from '@/directive'
// import VueDOMPurifyHTML from 'vue-dompurify-html'
import '@/plugin/last-commit-msg/toggle.js'
import { mockRuqest } from './mock'
// import '@/style/base.scss'

// import WebsocketPlugin from './page/demo/websocket/websocket-plugin'
// import 'vant/lib/index.css'
// import { Dialog, Swipe, SwipeItem, Image as VanImage, Cell, CellGroup, Popup, IndexBar, IndexAnchor, DatePicker, Area, Picker, ConfigProvider, List, PullRefresh, Lazyload } from 'vant'
// import 'viewerjs/dist/viewer.css'
// import VueViewer from 'v-viewer'
// import { ElMessage, ClickOutside } from 'element-plus'
// import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 持久化存储pinia
// import piniaPluginPersist from 'pinia-plugin-persist'

Http.init()

if(import.meta.env.MODE === 'mock') {
	mockRuqest()
}

const store = createPinia()
// store.use(piniaPluginPersist)
const app = createApp(App)

// app.use(Dialog);
// app.use(Area);
// app.use(DatePicker);
// app.use(Picker);
// app.use(List);
// app.use(PullRefresh);
// app.use(Lazyload);
// app.use(ConfigProvider);
// app.use(VanImage);
// app.use(Popup);
// app.use(Cell);
// app.use(CellGroup);
app.use(ElementPlus)
// app.use(Swipe)
// app.use(SwipeItem)
// app.directive('clickoutside', ClickOutside)
// app.config.globalProperties.$message = ElMessage;
// app.provide('$abc', ElMessage)
// for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
//     app.component(key, component)
// }
// app.use(IndexBar);
// app.use(IndexAnchor);
app.use(store)
app.use(router)
app.use(components)
app.use(i18n)
app.use(directive)
// app.use(VueDOMPurifyHTML)
// app.use(WebsocketPlugin)
app.mount('#app')
